﻿using System.Collections.Generic;
using System.Linq;
using MaxStoreErp.Core.Extensions;
using MaxStoreShop.Domain.Directories;
using MaxStoreShop.Logic.RepositoriesContracts.Directories;

namespace MaxStoreShop.Dal.Repositories.Directories
{
    public class UserRepository : RepositoryBase, IUserRepository
    {
        public IEnumerable<StoreUser> GetUsers()
        {
            return Context.Users.NotDeleted();
        }

        public void DeleteUser(int userId)
        {
            SafeDelete(Context.Users.First(c => c.Id == userId));
        }

        public void SaveUser(StoreUser user)
        {
            SaveEntity(user);
        }
    }
}
